<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的第一个js</title>
</head>
<body>
<p>alert弹出框</p>
<script>
//除非确定了数据类型，可以用alert来调试
    alert('js显示框')//注释
    var A=200
    console.log(A)

    //s数据类型
    //使用变量前先声明并初始化
    var s='i am a student';
    console.log(s);
    var s1=' who study in uniwersity of hunan techonology';
    var s0=s+s1;
    console.log(s0);
    var a1='1';
    var a2=1;
    console.log(a1+a2);
    console.log(a1*1+a2);
    var a3;//没有初始化时undefined类型
    if(a3=== undefined){
    console.log('未定义')
    }
    var arr1=[1,2,3,45,9];
    for(var i=0;i<arr1.length;i++){
    console.log(arr1[i]);
    }

    for(x in arr1){
    console.log(arr1[x]);
    }

    var obj={
    name:'pan',
    age:20,
    getage:function(){cinsole.log(obj.age;
    return this.age)}}

    console.log(obj.age);
    console.log(obj.getage());
    obj.adrress='工业大学';
    console.log(obj.adrress);
    console.log(obj);

    //定义函数
    function hello(name){console.log('hello'+name)}
    hello('pan');


    //函数2
    var hello1=function(name){console.log('hello2'+name)}
    hello1('panyanzhen');

</script>

<script>
    alert(123)
</script>
</body>
</html>